package cn.bon.user.controller;

import cn.bon.common.bean.JsonResult;
import cn.bon.common.enums.bonuser.RoleStateEnum;
import cn.bon.user.pojo.po.RolePo;
import cn.bon.user.service.RoleService;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.annotation.Resource;
import jakarta.websocket.server.PathParam;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author: dronff
 * @description:
 * @CreateTime: 2023/12/11 9:29
 **/
@RestController
@RequestMapping("/role")
@Schema(description = "角色增删改查")
public class RoleController {
    @Resource
    private RoleService roleService;
    @GetMapping(value = {
            "/pageRoles"
    })
    public JsonResult<List<RolePo>> pageRoles(@PathParam("roleName") String roleName,
                                              @PathParam(value = "roleState") RoleStateEnum type){
        return roleService.pageRoles(roleName,type);
    }

    @DeleteMapping(value = {
            "/deleteRoleById"
    })
    public JsonResult deleteRoleById(@RequestParam int roleId){
        return roleService.deleteRoleById(roleId);
    }
}
